/**
 * https://leetcode-cn.com/problems/two-sum/
 */
 var twoSum = function(nums, target) {
    const hashMap = new Map();
    for (let i = 0; i < nums.length; i ++) {
        const num = nums[i];
        const matchNum = target - num;
        if (hashMap.has(matchNum)) {
            return [hashMap.get(matchNum), i];
        }
        hashMap.set(num, i);

    }
    return [];
};
